package com.woniuxy.micropromotionserver.promotionmag.controller;

import com.github.pagehelper.PageInfo;
import com.slsupermarket.common.res.ResponseMsg;
import com.woniuxy.micropromotionserver.bean.PageRequest;
import com.woniuxy.micropromotionserver.bean.PromotionBean;
import com.woniuxy.micropromotionserver.bean.TableResult;
import com.woniuxy.micropromotionserver.promotionmag.service.IPromotionOrderService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/promotion")
public class PromotionOrderController {

    @Resource
    private IPromotionOrderService promotionOrderServiceImpl;

    /**
     * 1 分页查询 接收 promoType 看看是订单促销还是商品促销 
     * 这是两个不一样页面的分页请求
     */
    @GetMapping("/findByType")
    public TableResult findByType(PageRequest request, PromotionBean promotionBean){
/*
        System.out.println(request);
        System.out.println(promotionBean);*/
        //调,查
        PageInfo<PromotionBean> pageInfo= promotionOrderServiceImpl.findByPromoType(request, promotionBean);

       return new TableResult<PromotionBean>(pageInfo.getTotal(),pageInfo.getList());
    }

    public ResponseMsg findByType1(){
        //自己的返回信息对象
        ResponseMsg res=new ResponseMsg();
        //调



        return res;
    }


}
